/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.brain.prod.dto;

import com.brain.core.dto.ParametroDto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author Jeferson
 */
@Entity
@Table(name = "TPROD_COSTO_INDIRECTO_DETA")
public class CostoIndirectoDetaDto implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "SEQ_TPROD_COSTO_INDIRECTO_DETA")
    @TableGenerator(name = "SEQ_TPROD_COSTO_INDIRECTO_DETA", table = "TCORE_ENTIDAD", pkColumnName = "NOMBRE", valueColumnName = "CORRELATIVO", pkColumnValue = "TPROD_COSTO_INDIRECTO_DETA", allocationSize = 1)
    private Long id;
    @JoinColumn(name = "COSTO_INDIRECTO", referencedColumnName = "ID")
    @ManyToOne
    private CostoIndirectoDto costoIndirectoDto;
    @Column(name = "FECHA_DESDE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaDesde;
    @Column(name = "FECHA_HASTA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaHasta;
    @JoinColumn(name = "UOM", referencedColumnName = "ID")
    @ManyToOne
    private ParametroDto uomDto;
    @Column(name = "COSTO")
    private BigDecimal costo;
    @Column(name = "TOTAL")
    private BigDecimal total;    
    @Column(name = "CALCULADO")
    private Boolean calculado;
    @Transient
    private String calculadoTexto;
    
    public CostoIndirectoDetaDto() {
    }

    public CostoIndirectoDetaDto(Long id) {
        this.id = id;
    } 

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public CostoIndirectoDto getCostoIndirectoDto() {
        return costoIndirectoDto;
    }

    public void setCostoIndirectoDto(CostoIndirectoDto costoIndirectoDto) {
        this.costoIndirectoDto = costoIndirectoDto;
    }

    public Date getFechaDesde() {
        return fechaDesde;
    }

    public void setFechaDesde(Date fechaDesde) {
        this.fechaDesde = fechaDesde;
    }

    public Date getFechaHasta() {
        return fechaHasta;
    }

    public void setFechaHasta(Date fechaHasta) {
        this.fechaHasta = fechaHasta;
    }

    public ParametroDto getUomDto() {
        return uomDto;
    }

    public void setUomDto(ParametroDto uomDto) {
        this.uomDto = uomDto;
    }

    public BigDecimal getCosto() {
        return costo;
    }

    public void setCosto(BigDecimal costo) {
        this.costo = costo;
    }

    public BigDecimal getTotal() {
        return total;
    }

    public void setTotal(BigDecimal total) {
        this.total = total;
    }

    public Boolean getCalculado() {
        return calculado;
    }

    public void setCalculado(Boolean calculado) {
        this.calculado = calculado;
    }

    public String getCalculadoTexto() {
        if (calculado) {
            calculadoTexto = "SI";
        }
        else {
            calculadoTexto = "NO";
        }
        return calculadoTexto;
    }

    public void setCalculadoTexto(String calculadoTexto) {
        this.calculadoTexto = calculadoTexto;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CostoIndirectoDetaDto)) {
            return false;
        }
        CostoIndirectoDetaDto other = (CostoIndirectoDetaDto) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.brain.prod.dto.CostoIndirectoDetaDto[ id=" + id + " ]";
    }
}
